home *** CD-ROM | disk | FTP | other *** search
/ Info-Mac 4 / Info_Mac IV CD-ROM (Pacific HiTech Inc.)(August 1994).iso / Development / Source / MSG Demo 1.4.source Folder / Demo ƒ / Fades reversed ƒ / Quadrant fade 2 reversed.c < prev    next >
Text File  |  1994-04-15  |  3KB  |  85 lines

  1. /**********************************************************************\
  2.  
  3. File:        Quadrant fade 2 reversed.c
  4.  
  5. Purpose:    Graphic effect from offscreen bitmap to main window (on
  6.             screen).  See comments below for more description.
  7.  
  8. This program is free software; you can redistribute it and/or modify
  9. it under the terms of the GNU General Public License as published by
  10. the Free Software Foundation; either version 2 of the License, or
  11. (at your option) any later version.
  12.  
  13. This program is distributed in the hope that it will be useful,
  14. but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  16. GNU General Public License for more details.
  17.  
  18. You should have received a copy of the GNU General Public License
  19. along with this program in a file named "GNU General Public License".
  20. If not, write to the Free Software Foundation, 675 Mass Ave,
  21. Cambridge, MA 02139, USA.
  22.  
  23. \**********************************************************************/
  24.  
  25. #include "timing.h"
  26.  
  27. #define CorrectTime 3
  28. #define theWindowHeight (boundsRect.bottom-boundsRect.top)
  29. #define theWindowWidth (boundsRect.right-boundsRect.left)
  30. #define NUM_ITERATIONS    25
  31.  
  32. pascal short QuadrantFade2Reversed(Rect boundsRect, Pattern *thePattern);
  33.  
  34. /* 4 regions, splitting the screen into 4 quadrants.  Wipe the screen right in
  35.    the top-left quadrant, down in the top-right, left in the bottom-right,
  36.    up in the bottom-left. */
  37.    
  38. pascal short QuadrantFade2Reversed(Rect boundsRect, Pattern *thePattern)
  39. {
  40.     int            x;
  41.     Rect        tldest, trdest, bldest, brdest;
  42.     int            cx,cy;
  43.     int            BoxSize, HBoxSize;
  44.     
  45.     BoxSize=theWindowHeight/(NUM_ITERATIONS*2);
  46.     HBoxSize=theWindowWidth/(NUM_ITERATIONS*2);
  47.     
  48.     cx = boundsRect.left + theWindowWidth / 2;
  49.     cy = boundsRect.top + theWindowHeight / 2;
  50.     
  51.     tldest=trdest=bldest=brdest=boundsRect;
  52.     tldest.right=trdest.left=bldest.right=brdest.left=cx;
  53.     tldest.bottom=trdest.bottom=bldest.top=brdest.top=cy;
  54.     trdest.right=trdest.left+HBoxSize;
  55.     brdest.bottom=brdest.top+BoxSize;
  56.     bldest.left=bldest.right-HBoxSize;
  57.     tldest.top=tldest.bottom-BoxSize;
  58.     
  59.     for (x=0; x<NUM_ITERATIONS; x++)
  60.     {
  61.         StartTiming();
  62.         FillRect(&trdest, *thePattern);
  63.         trdest.left+=HBoxSize;
  64.         trdest.right+=HBoxSize;
  65.         
  66.         FillRect(&brdest, *thePattern);
  67.         brdest.top+=BoxSize;
  68.         brdest.bottom+=BoxSize;
  69.         
  70.         FillRect(&bldest, *thePattern);
  71.         bldest.left-=HBoxSize;
  72.         bldest.right-=HBoxSize;
  73.         
  74.         FillRect(&tldest, *thePattern);
  75.         tldest.top-=BoxSize;
  76.         tldest.bottom-=BoxSize;
  77.         
  78.         TimeCorrection(CorrectTime);
  79.     }
  80.     
  81.     FillRect(&boundsRect, *thePattern);            /* fill the whole screen to end it */
  82.     
  83.     return 0;
  84. }
  85.